from contextlib import asynccontextmanager

from fastapi import FastAPI

from app.api.endpoints import RootRouter
from app.core.events import chip_choice_lifespan


def create_app() -> FastAPI:
    """
    创建应用实例
    :return:
    """
    chip_choice_app: FastAPI = FastAPI(lifespan=chip_choice_lifespan)
    # 注册路由
    chip_choice_app.include_router(RootRouter)
    return chip_choice_app
